home *** CD-ROM | disk | FTP | other *** search
- ; ***************************************************************************
- ; Assembly language functions for LANtastic
- ; 01/07/88 JEM Created
- ; 02/18/91 JEM Updated for use w/MASM 5.1
- ; ***************************************************************************
-
- .MODEL COMPACT,C
- .CODE
-
- ;
- ; Name: nos_present
- ; Function: Determines whether or not LANtastic is running
- ; Caller: MSC 4.0, Compact
- ; Args: none
- ; returns TRUE or FALSE (1 or 0)
- ; Author: JM
- ; Date: 10/26/89
- ;
- nos_present PROC NEAR USES ES DS SI DI
- mov ax,0B800H
- int 2Fh
- and al,al ; test result
- jnz nos_ok ; if nz, LANtastic is running
- xor ax,ax ; LANtastic isn't running
- jmp nos_end ; return to caller
- nos_ok:
- xor ax,ax
- inc ax ; return TRUE
- nos_end:
- ret
- nos_present ENDP
-
- ;
- ; Name: get_inactive_server
- ; Function: Returns the name of a LANtastic server that you are not
- ; logged into. Returns TRUE if no error, FALSE if error
- ; Caller: MS C compact model
- ; Args: get_inactive_server(buffer,index)
- ; unsigned char *buffer; /* 16 byte buffer */
- ; int index; /* index of server name entry */
- ; Author: JEM
- ; Date: 8/17/89
- ;
- get_inactive_server PROC NEAR USES ES DS SI DI, buffer:PTR, index:WORD
-
- ; set up LANOS function call
- les di,buffer ; ES:DI points to buffer
- mov bx,index
- mov ax,5F84H ; Get inactive server fn.
- int 21H ; Call function
-
- ; Process results
- jc GIS_ERR ; we have an error
- ; Success! - we found an inactive server
- mov ax,1
- jmp GIS_DONE
-
- ; Failure - no inactive servers
- GIS_ERR:
- xor ax,ax ; set up FALSE return code
-
- ; we're done -- clean up and go home
- GIS_DONE:
- ret
- get_inactive_server ENDP
-
- ;
- ; Name: get_active_server
- ; Function: Returns the name of a LANtastic server that you are
- ; logged into. Returns TRUE if no error, FALSE if error
- ; Caller: MS C compact model
- ; Args: get_active_server(buffer,index)
- ; unsigned char *buffer; /* 16 byte buffer */
- ; int index; /* index of server name entry */
- ; Author: JEM
- ; Date: 8/17/89
- ;
- get_active_server PROC NEAR USES ES DS SI DI, buffer:PTR, index:WORD
- mov ax,5F80h ; Get login entry fcn
- les di,buffer ; Point to receiving buffer
- mov bx,index ; index entry
- int 21h ; Call LANOS
- ; Process results
- jc GAS_ERR ; we have an error
- ; Success! - we found an active server
- mov ax,1
- jmp GAS_DONE
-
- ; Failure - no active servers
- GAS_ERR:
- xor ax,ax ; set up FALSE return code
-
- ; we're done -- clean up and go home
- GAS_DONE:
- ret
- get_active_server ENDP
-
-
- ;
- ; Name: login
- ; Function: Attempts to log into a LANtastic server
- ; Returns an error code -- 0 if no error
- ; Caller: MS C compact model
- ; Args: login(buffer)
- ; unsigned char *buffer; /* login path buffer */
- ; Author: JEM
- ; Date: 8/17/89
- ;
- login PROC NEAR USES ES DS SI DI, buffer:PTR
-
- ; call the LANOS login function
- les di,buffer ; ES:DI points to buffer
- mov bl,0ffh ; try all valid adapters
- mov ax,5F81h ; login subfn
- int 21h ; call function.
-
- ; process the result
- jc LOG_DONE ; if CS, we have a problem
- xor ax,ax ; else, return a happy 0
-
- ; we're done -- clean up and go home
- LOG_DONE:
- ret
- login ENDP
-
- ;
- ; Name: logout
- ; Function: Attempts to log out of a LANtastic server
- ; Returns an error code -- 0 if no error
- ; Caller: MS C compact model
- ; Args: logout(buffer)
- ; unsigned char *buffer; /* login path buffer */
- ; Author: JEM
- ; Date: 8/17/89
- ;
- logout PROC NEAR USES ES DS SI DI, buffer:PTR
-
- ; call the LANOS login function
- les di,buffer ; ES:DI points to buffer
- mov ax,5F82h ; logout
- int 21h ; call function.
-
- ; process the result
- jc OUT_DONE ; if CS, we have a problem
- xor ax,ax ; else, return a happy 0
-
- ; we're done -- clean up and go home
- OUT_DONE:
- ret
- logout ENDP
-
- ;
- ; Name: get_error_text
- ; Function: Convert LANOS error code to text form
- ; returns a far pointer to the error text string
- ; Caller: MSC compact
- ; Args: get_error_text(code)
- ; Author: JEM
- ; Date: 8/23/89
- ;
- get_error_text PROC NEAR USES ES DS SI DI, errcode:WORD
- mov ah,5 ; Expand error code fcn
- mov al,byte ptr (errcode)
- mov bx,errcode
- int 02Fh ; Multiplex interrupt
-
- mov dx,es ; return far ptr to string
- mov ax,di
-
- ret
- get_error_text ENDP
-
- halt PROC NEAR
- hlt
- halt ENDP
-
- ;
- ; Name: redirect_device
- ; Function: Redirects a device on the network
- ; Caller: MSC compact
- ; Args: redirect_device(device,netpath,dtype)
- ; char *device,*netpath;
- ; int dtype;
- ; Author: JEM
- ; Date: 8/23/89
- ;
- redirect_device PROC NEAR USES ES DS SI DI, device:PTR, netpath:PTR, dtype:WORD
- lds si,device ; Device to redirect in DS:SI
- les di,netpath ; Network path in ES:DI
- mov bl,byte ptr (dtype) ; 3 if printer, 4 if disk
- mov cx,0 ; Value to store w/ device
- mov ax,5F03h ; LANOS redirect function
- int 21h ; redirect the device
-
- ; process the result
- jc RE_DONE ; if CS, we have a problem
- xor ax,ax ; else, return 0
-
- ; we're done -- clean up and go home
- RE_DONE:
- ret
- redirect_device ENDP
-
- ;
- ; Name: cancel_redirection
- ; Function: Cancel a network redirection
- ; Caller: MSC compact
- ; Args: cancel_redirection(device)
- ; char *device
- ; Author: JEM
- ; Date: 8/23/89
- ;
- cancel_redirection PROC NEAR USES ES DS SI DI, device:PTR
- lds si,device ; Device to redirect in DS:SI
- mov ax,5F04h ; LANOS cancel redirect function
- int 21h ; cancel the redirection
-
- ; process the result
- jc CR_DONE ; if CS, we have a problem
- xor ax,ax ; else, return 0
-
- ; we're done -- clean up and go home
- CR_DONE:
- ret
- cancel_redirection ENDP
-
- whoami PROC NEAR USES DS SI, node:PTR
- lds dx,node ; Point DS:DX to name buffer
- mov ax,05E00h ; Get machine name fcn
- int 21h ; do it
- ret
- whoami ENDP
-
- ;
- ; Name: get_user_info
- ; Function:
- ; Caller: MSC 4.0, Compact
- ; Args: int get_user_info(server,index,buffer)
- ; char *server;
- ; int index;
- ; ACTIVE_USER *buffer; /* defined in LANTASTI.H */
- ; Author: JM
- ; Date: 10/31/89
- get_user_info PROC NEAR USES ES DS SI DI, server:PTR, index:WORD, buffer:PTR
- mov bx,index ; Number of login entry.
- les di,server ; Server to query
- lds si,buffer ; Buffer for result
- mov ax,5FB0H ; LANOS get active user info fn.
- int 21H ; Get user info.
-
- ; process the result
- jc GUI_DONE ; if carry set, there was an error
- xor ax,ax ; otherwise, return 0
- GUI_DONE:
- ret
- get_user_info ENDP
-
- END
-